<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title><?php echo $store_name;?></title>
        <meta charset="UTF-8">
        <meta name="description" content="<?php echo $action['action_name'];?>">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
        <script>
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?8d43b5b5d798921b66d689f7a792e6e2";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript">
            document.domain = '<?php echo _DOMAIN_ALL_;?>';
        </script>
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
    </head>
    <body <?php  if(strstr($_SERVER['REQUEST_URI'],'user/passport/login')){ echo 'class="_login_backimg"';}?>>


   <link href="/public/css/main.css" rel="stylesheet">
<div class="container" style='font-size:10px;' >
    <div class='_main'>
        <div style='height:1.5rem'></div>
        <div class="<?php if(strstr($_SERVER['REQUEST_URI'],'user/passport/login')){ echo '_banner';}else{ echo 'banner';}?>">
            <?php if(!strstr($_SERVER['REQUEST_URI'],'user/passport/login')){?>
            <div class='_logo' >
                <a href='#'><img src="/public/images/kaka.png" class='logo_img'  alt='banner' style="width:30%"/></a>
            </div>
            <?php } ?>
            <?php $image = explode('/',$action['logo']);$_img = array_pop($image);$image = implode('/',$image)."/"."max_".$_img; ?>
            <img src="<?php  if(strpos($action['logo'],'crowd.png')){ echo 'http://'.IMAGE_DOMAIN_.'/upload/crowd.png';}else{ echo 'http://'.IMAGE_DOMAIN_.$image; } ?>" class="<?php if(strstr($_SERVER['REQUEST_URI'],'user/passport/login')){ echo '_banner_img'; }else{ echo 'banner_img'; }?>"  id='change'  alt='banner' />
        </div>
        <div style='float:left;margin-top:-4.5rem;position: absolute;' >
            <a href="<?php echo 'http://www.'._DOMAIN_ALL_.'/actions/past_action.html';?>"><img src="/public/images/past_crowd.png" ></a>
        </div>
        <div style='text-align:center;width:10rem;height: 10rem;right:2%;margin-top:-5rem;position: absolute;z-index:100;background-color:white;border-radius:50%;'>
            <div style='height:10rem;width:10rem;'>
            <img src="<?php if(strlen($headimg)>0){echo $headimg;}else{echo '/public/images/tou.png';}?>" id='change'  style="width:100%;height: 100%;border-radius:50%;overflow:hidden;">
            </div>
            <div style='height:1rem'></div>
            <p style="font-size:1.5rem;color:black;"><b><?php echo '爱心大使';?></b></p>
            <p style="margin-top:-1rem;font-size:1.5rem;color:black; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;"><b><?php echo ($nickname?$nickname:'虚位以待');?></b></p>
       
        </div>



<script src="/public/js/islider.js"></script>
<script src="/public/js/islider_desktop.js"></script>
<?php $action['content'] = json_decode($action['content'],true);?>
<div style='height: 8rem'>
    <div class='_line'></div>
    <div class='_line'></div>
    <a href="#" onClick='opencode();'><b>点击－>关注公众号，查看订单。</b></a>
</div>

<div class="_preview_div">

    <div class='box'>
        <?php  if($count>0){ ?>
        <h6>爱心使者：</h6>
        <div style="width:100%">
            <?php foreach($team as $k=>$v){ if($k >= 7 ){ break; } ?>
                <div style="float: left;width:13%">
                    <div class='headimg'>
                        <img class='head_img' src="<?php echo $v['headimg']?>"/>
                    </div>

                </div>
                <div style='float: left;'>&nbsp;&nbsp;</div>
            <?php } ?>

                <div class='headimg' style='float: left;font-size:1.5rem;padding-top:1rem; border:1px solid #a1a1a1; background:#dddddd; ' ><?php echo $count?$count:0;?> </div>
        </div>
        
        <?php } ?>

        <div class="clearfix"></div>
        <h3><?php echo $action['action_name'];?></h3>
        <div style="height: 1rem"></div>
        <div class="box">
            <div ><img src="/public/images/crowd.png" style='width:15%;float:left;'></div>
            <div style='float: left;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
            <div style='font-size:1.3rem;padding-left:17%;' >本活动为公益活动，【<?php echo $store['name']; ?>】承诺每成交一笔订单（注：<span style='color:red;'>订单完成是指到店完成消费</span>）将为KAKA公益捐助9.9元爱心基金用于【<?php echo $action['content']['crowd_name']; ?>】项目的公益捐助，目前已成交<?php echo $count?$count:0;?>笔。</div>
            
            <div  style='clear:both;'></div>
            <div class='cut_3'></div>

        </div>
        <span class='colors-size'><?php echo $action['intro'];?></span>
    </div>

    <div class='_line'></div>
    <link href="/public/css/action.css" rel="stylesheet">

    <!-- 商品 list start -->

    <div class='box'>

        <?php if($items){ $ids = $action['content']['ids']; $v = $items['0']; ?>

                <div style="width:100%">
                    <div id="iSlider-effect-wrapper">
                        <div id="non-looping_<?php echo $v['id'];?>" class="iSlider-effect"></div>
                        <div class='img_number'><?php echo count($v['images']);?>图</div>
                    </div>
                </div>
                <div style="clear:both"></div>
                <script>
                var picList_<?php echo $v['id'];?> = [
                <?php foreach($v['images'] as $kk => $vv){ $image = explode('/',$vv['image']);$_img = array_pop($image);$image = implode('/',$image).'/'.'max_'.$_img;?>
                    {
                        width: '100%',
                            height: '100%',
                        content: "http://<?php echo IMAGE_DOMAIN_.$image;?>"
                    } <?php if ($kk + 1 < count($v['images'])){echo ','; }?>
                <?php } ?>
                ];
                //不循环 不自动播放
                var islider_<?php echo $v['id'];?> = new iSlider({
                    data: picList_<?php echo $v['id'];?>,
                dom: document.getElementById("non-looping_<?php echo $v['id'];?>"),
                    duration: 4000,
                    animateType: 'default',
                    isAutoplay: true,
                    isLooping: true,
                    hand: true,
                });
                islider_<?php echo $v['id'];?>.bindMouse();
            </script>
                <div>
                    <img src="/public/images/crowd_2.png" style='width:17%;float:left;margin-top:0.7rem;'>&nbsp;&nbsp;
                    <span class='big_title'><?php echo $v['name'];?></span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class='small_title'><?php echo $v['title'];?></span>
                </div>
                <div class='cut_3'></div>
                <div class='cut'></div>
                <div class='cut_3'></div>
                <div>
                    <span class='_price'><s>原价：￥<?php echo $v['old_price']/100;?></s></span>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class='_price'>爱心款：￥<?php echo $ids[$v['id']]/100;?></span>
                </div>
                <div class='cut_3'></div>
                <div class='cut'></div>
                <div class='cut_3'></div>
                    <?php if($v['is_meal_set']==1){ ?>
                        <div class='set_content'>
                            套餐内容：<br/>
                            <?php foreach($v['meal_set_items'] as $kk=>$vv){ ?>
                            <a href="<?php echo shop_buildUrl('/user/shop/info?item_id='.$vv['id']);?>" ><b><?php echo $vv['name'];?></b></a>&nbsp;&nbsp;&nbsp;<?php echo $vv['number'];?>&nbsp;个/次<br/>
                            <?php }?>
                        </div>
                        <div class='cut_3'></div>
                        <div class='cut'></div>
                    <?php }?>
                <div class='cut_3'></div>
                <div class='intro colors-size'>
                    <?php echo $v['intro'];?>
<?php if(in_array($action['id'],array(219,220,221,222,223,224))){?>
        <img src='/image/ac.jpeg' style='width:100%'>
<?php }?> 
                </div>
                <div class='cut_3'></div>
                <div class='cut'></div>
                <div class='cut_3'></div>

        <?php }else{?>

                <i><?php foreach( $action['content']['content'] as $k=>$v ){ $v['old'] = $v['old']/100;$v['new'] = $v['new']/100; echo "<span><h4>".$k."：原价<s><span style='color:red'>".$v['old']."</span></s>&nbsp;&nbsp;众筹价<span style='color:red'>".$v['new']."</span><br/>内容：<span style='color:red'>".$v['content']."</span></span></h4>"; }?>
                </i>

        <?php }?>

    </div>

    <!-- 商品 list end -->

        

        <div class='box'>
            <span class='colors'>活动日期:</span>
            <span class='colors-size'><?php echo date("Y年m月d日",$action['start_time']);?>&nbsp;至&nbsp;<?php echo date("Y年m月d日",$action['end_time']);?></span>
            </br>
            <span class="colors">使用截止日期:</span>
            <span class='colors-size'><?php echo date("Y年m月d日",$action['use_end_time']);?></span>
        </div>
        <div class='box'>
            <span class='colors'>联系人:</span>
            <span class='colors-size'><?php echo $store['person_charge'];?></span>
        </div>
        <div class='box'>
            <span class='colors'>Tel:</span>
            <span class='colors-size'><?php echo $store['tel'];?></span>
        </div>

        <div class='_line'></div>

        <div class='box'>
            <img style='width:100%' src='http://apis.map.qq.com/ws/staticmap/v2/?center=<?php echo $store["latlng"];?>&zoom=13&size=600*300&maptype=roadmap&markers=size:large|color:0xff0000|label:P|<?php echo $store["latlng"];?>&key=5LTBZ-Z6PC5-WAGIB-QXGAX-JBVBF-XQBTP'/>
        </div>

        <div class='_line'></div>

        <div class='box'>
            <span class='colors'>地址:</span>
            <span class='colors-size'><?php echo $store['address'];?></span>
        </div>

        <div class='_line'></div>

        <form id="form">
            <div class='box'>
                <input style="width:100%;height:3rem" type="text" value="" id="user_name" placeholder="请输入姓名"/>
            </div>
            <div class='_line3'></div>
            <div class='box'>
                <input style="width:100%;height:3rem" type="text" value="" id="mobile" placeholder="请填写手机号"/>
            </div>
            <div class='_line3'></div>
            <div class='box'>
                <input style='width:60%;height:3rem' type="text" value="" id="_code" placeholder="请填验证码">
                &nbsp;&nbsp;&nbsp;<button type="button" id='subcode' style='width:30%'>获取验证码</button>
            </div>
            <div class='_line3'></div>
                <input type="hidden" name="type_pay" id="type_pay" value="<?php echo $pay_status; ?>">
            <div class='box'>
                <select style="width:100%;height:3rem" name="type" id="type">
                <?php foreach($items as $v){ echo "<option value='".$v['id']."'>".$v['name']."</option>"; }?>
                </select>
            </div>
        </form>

        <div style="height: 5rem"></div>
        <?php if($option!=true){?>
            <div class='box navbar-fixed-bottom' style="text-align: center;">
                    <button class="btn btn-primary btn-lg" id='_add' type="button" style="width:98%;background-color:#FF79BC;border-color:white">我要代言</button>
            </div>

        <?php }?>
        <div class='box navbar-fixed-top' style="text-align: center;width:100%;height:6%;">
            <div  id='business_add' type="button" style="background-color:rgba(79, 79, 79, 0.7);width:49.8%;height:100%;border-color:#797979;float:left;color:white;font-size:14px;padding-top:1rem;">商家参与入口</div>
            <div  id='suggest' type="button" style="background-color:rgba(79, 79, 79, 0.7);width:49.8%;height:100%;border-color:#797979;float:right;color:white;font-size:14px;padding-top:1rem;">用户反馈</div>
        </div>
</div>


<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    function code() {
        var mobile = $("#mobile").val();
        $.ajax({url: "/user/barber/code?mobile=" + mobile, async: true, success: function (msg) {
            if (msg != 'true') {
                alert(msg);
                return false;
            }
            $("#subcode").text('60');
            $("#subcode").attr('disabled', 'disabled');
            var t = setInterval(function () {
                var m = $("#subcode").text();
                var str = parseInt(m) - 1;
                if (str <= 0) {
                    str = '获取验证码';
                    $("#subcode").removeAttr('disabled');
                    clearInterval(t);
                }
                $("#subcode").text(str);
            }, 1000);
        }
        });
    }
    var _mobile = /^(((1[1-9]{1}[0-9]{1})|(15[0-9]{1}))+\d{8})$/
    $(document).ready(function () {
        // 判断是否是支付后跳转回来的 start
        var pay_status = $("#type_pay").val();
        if ( pay_status == 'ok' )
        {
            $("#_pay_ok").show();
        }
        // end

        $("#subcode").click(function(){
            code();
        });
        var weixin_str = '&nickname=<?php echo $name;?>&sex=<?php echo $sex;?>&headimg=<?php echo urlencode($photo);?>';
        $("#_add").click(function(){
            document.getElementsByTagName('body')[0].scrollTop=document.getElementsByTagName('body')[0].scrollHeight;
            var mobile = $("#mobile").val();
            var code = $("#_code").val();
            var type = $("#type").val();
            var user_name = $("#user_name").val();
            if(!_mobile.test(mobile)){
                alert('请先填写手机号');
                return false;
            }
            if ( code.length != 6 )
            {
                alert( "请输入正确的验证码" );
                return false;
            }
            $.ajax({url: "/user/barber/checkcode?code=" + code + "&mobile=" + mobile, async: true, success: function (msg) {
                if (msg != 'true') {
                    alert('验证码错误');
                }else{
                    var str = "&code="+code+"&mobile="+mobile+"&type="+type+"&user_name="+user_name+weixin_str;
                    window.location.href="<?php echo buildUrl('/user/order/createorder',(int)$_GET['barber_id']);?>&team_number=<?php echo $_GET['team_number']?$_GET['team_number']:'';?>&aid=<?php echo $action['id'];?>&verify=<?php echo $verify;?>"+str;
                }
            }
            });
        });

        //商家参与
        $('#business_add').click(function(){
            window.location.href="<?php echo buildUrl('/center/business/business_add',(int)$_GET['barber_id']);?>";
        });
        //用户反馈
        $('#suggest').click(function(){
            window.location.href="<?php echo buildUrl('/center/questionnaire/suggest',(int)$_GET['barber_id']);?>";
        });
    });
    <?php if($weixin == true){?>
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<?php echo WEIXIN_PAY_APP_ID;?>', // 必填，公众号的唯一标识
            timestamp: <?php echo $data["timestamp"];?>, // 必填，生成签名的时间戳
        nonceStr: '<?php echo $data["noncestr"];?>', // 必填，生成签名的随机串
            signature: '<?php echo $data["sign"];?>',// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
        wx.ready(function () {
            wx.onMenuShareTimeline({
                title: '【<?php echo $nickname; ?>】出任爱心大使！速来围观！', // 分享标题
                link: '<?php echo $data["url"];?>', // 分享链接
                imgUrl: '<?php echo "http://".IMAGE_DOMAIN_.$action["logo"];?>', // 分享图标
                success: function () {


                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数

                }
            });
            wx.onMenuShareAppMessage({
                title: "【<?php echo $nickname; ?>】出任爱心大使！速来围观！", // 分享标题
                desc: "<?php echo strip_tags($action['intro']);?>", // 分享描述
                link: '<?php echo $data["url"];?>', // 分享链接
                imgUrl: '<?php echo "http://".IMAGE_DOMAIN_.$action["logo"];?>', // 分享图标
                type: '', // 分享类型,music、video或link，不填默认为link
                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                success: function () {
                    // 用户确认分享后执行的回调函数

                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数

                }
            });
        })
        <?php }?>
</script>

<!-- 关注公众号链接 显示 start -->

<script type="text/javascript">
    function closecode(){
        $("#_qrcode").hide();
    }
    function opencode(){
        $("#_qrcode").show();
    }
</script>

<div id='_qrcode' style="text-align: center;width:100%;height:100%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');background-color:rgba(255, 255, 255, 0.7);position:fixed; _position:absolute; top:0;left:0; z-index:5000;display:none ">
    <?php if(strlen($store['code'])>0){?>
    <div style="padding-top:20rem">
        <img src="<?php echo $store['code'];?>" style='width:30rem;height:30rem'>
    </div>
    <div class='_line'></div>
    <a onclick='closecode();'><font style="font-size: 3rem;color:black"><b>关闭</b></font></a>
    <?php }?>
</div>

<!-- 关注公众号链接 显示 end -->



<!-- 支付成功后 页面显示 start -->

<div id='_pay_ok' style="text-align: center;width:100%;height:100%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');background-color:rgba(79, 79, 79, 0.8);position:fixed; _position:absolute; top:0;left:0; z-index:5000;padding:30% 7.5% 0% 7.5%;display:none ">
    <div style='background-color:#fff;margin-top:7rem;'>
        <div class='_line3' ></div>
        <h3 style="text-align: center;">提示</h3>
        <p style="text-align: left;font-size:1.3rem;margin:1rem;">&nbsp;&nbsp;
    　　恭喜亲，您已经成功代言本次公益众筹活动，成为本次活动的爱心大使！马上把这个好消息告诉您身边的好友，让我们一起让爱飞到更远的地方！
    </p>
        <p style="text-align: center;">
            <button class="btn btn-primary btn-lg" id="_hide_pay_title_ok" value="" style=" font-size:1.3rem;background-color:#FF79BC;border-color:white">好的</button>
        </p>
        <div class='_line3' ></div>
    </div>
</div>
<script>
    $("#_hide_pay_title_ok").click( function(){
        // 关闭窗口
        //$("#_pay_ok").hide();
        window.location.href = "<?php echo buildUrl('/user/action/info', $data['barber_id']) . '&team_number=' . $team_number . '&aid=' . $action['id'].'&nickname='.$nickname.'&headimg='.urlencode($headimg); ?>";
    });
</script>

<!-- 支付成功后 页面显示 end -->